home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
029a
/
mktst100.zip
/
MAKTST.BAS
(
.txt
)
< prev
next >
Wrap
QuickBASIC Tokenized Source
|
1991-12-27
|
6KB
|
104 lines
numberx
filename
ComLine+
NumArgs
Argsw
MaxArgs
FalseO
start
startingl
ending
StartNum&
EndNum5
FileSizey
BaseName
BaseExt
@ Interpret
argumentb
substr
SrtartNum
BaseFile
RIGHT
separator
Validate
ErrCode
Returns!
problem]
problem.
THENStartNum
THENEndNum
CheckLength
StrLen:
NumLen
MaxNum
AddNum
FWENDL
count
Maxcount
MaxNumber
exitsub
MAKTST 1.0 Copyright 1991 by Gordon Haff and Bit Masons.
All rights reserved.9
Create test files
Syntax: MAKTST /NUM=number /BEG=StartNum /END=EndNum /SIZE=FileSize /NAME=base.ext
If /SIZE is not specified, file size = 0 bytess
If "base" is not specified, the string 'tst' is used. 0 to 7 characters may
be specified as the base, but larger numbers means fewer files can be created
if no number and no /BEG and /END is specified, 1 file will be created
if number is specified but no /BEG or /END, the specified number of files
will be created starting with a 0
if number is specified and /BEG is specified (but no /END), the specified
number of files will be created starting with start_num
if number is specified and /END is specified (but no /BEG), the specified
number of files will be created (if possible) ending with end_num
if number is not specified and /BEG and /END are specified, files will be created
between those two numbers
if number is not specified and only /BEG or /END is specified, only one
file will be createdi
Set default values
Defaults changed by Interpreta
Command line over-specified"
Command line implies negative StartNum
Error Code 3
Filename too long to contain unique file identifiers
Command line under-specified (must provide NUM or BEG & END)
Get what was typed on command line
The number of arguments is N
A$ is an array containing the command-line arguments
MAKTST 1.0 Copyright 1991 by Bit Masons Consulting and Gordon Haff"
All rights reserved.
Command line syntax is as follows:
MAKTST /NUM=number /BEG=StartNum /END=EndNum /SIZE=FileSize /NAME=file.ext
You must specify number OR StartNum & EndNum"
By default 0 byte files are created and
the file base name is TST with no extension.
Loop through command line parameters and interpret
Fills out global variables
Program aborting
created
ComLine
Subroutine to get command line and split into argumentse
From QBasic 4.0 reference manual pg. 114
Interpret
Parse individual switch settings into numbers and a base file name
No particular validation is done. If the proper switch is not found,
the argument is ignored. The entry after the switch is converted in,
an appropriate way, but is not checked.
/BEG=",
/END=",
/NUM=",
/SIZE=,
/NAME=,
Validate
Does some simple Validation and sets up Begin/End/Number variables
Returns 0 if no problem.n
Returns 1 if command line over specifiedg
Returns 2 if command line results in negative StartNum
Returns 5 if insufficient command line information
CheckLength
Checks Max possible number versus number of files to generate
Returns ErrCode = 0 if OK and 4 otherwise
In case error code from previous function
Get number of spaces for number
Create MaxNum = 10 ^ "leftover spaces"